﻿using System; 
using System.Text;
using System.Collections.Generic; 
using System.Data;
using XQ.SP.Model;

namespace XQ.SP.BllServices{
	 	//个性设置
		public partial class ShopUserSetBLL : BaseBll
	{
   		     
		private readonly XQ.SP.DalServices.ShopUserSetDal dal=new XQ.SP.DalServices.ShopUserSetDal();
		public ShopUserSetBLL()
		{}
		
		#region  Method
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool ExistsWhere(string whereSql)
		{
			return dal.ExistsWhere(whereSql);
		}
		
		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public bool Exists(long Id)
		{
			return dal.Exists(Id);
		}

		
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public long  Add(XQ.SP.Model.ShopUserSetItem model)
		{
			return dal.Add(model);	
		}

		/// <summary>
		/// 批量增加数据
		/// </summary>
		public bool  AddList(List<XQ.SP.Model.ShopUserSetItem> models)
		{
            int rows=dal.AddList(models);
            if (rows > 0)
                return true;
            else
                return false;
		}


		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(XQ.SP.Model.ShopUserSetItem model)
		{
			return dal.Update(model);
		}

		/// <summary>
		/// 批量更新数据
		/// </summary>
		public int UpdateList(List<XQ.SP.Model.ShopUserSetItem> models)
		{
			return dal.UpdateList(models);
		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(long Id)
		{
			
			return dal.Delete(Id);
		}
				/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool DeleteList(string Idlist )
		{
			return dal.DeleteList(Idlist );
		}
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public XQ.SP.Model.ShopUserSetItem GetModel(long Id)
		{
			
			return dal.GetModel(Id);
		}
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public XQ.SP.Model.ShopUserSetItem GetModelWhereStr(string whereSql)
		{
			
			return dal.GetModelWhereStr(whereSql);
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere="")
		{
			return dal.GetList(strWhere);
		}
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			return dal.GetList(Top,strWhere,filedOrder);
		}
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<XQ.SP.Model.ShopUserSetItem> GetModelList(string strWhere="")
		{
			DataSet ds = dal.GetList(strWhere);
			return DataTableToList(ds.Tables[0]);
		}
		
        /// <summary>
        /// 获得新增的数据
        /// </summary>
        public List<XQ.SP.Model.ShopUserSetItem> GetModelListNew(string datetimeStr)
        {
            DataSet ds = dal.GetList(" Created>='"+datetimeStr+"' ");
            return DataTableToList(ds.Tables[0]);
        }
        
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public List<XQ.SP.Model.ShopUserSetItem> DataTableToList(DataTable dt)
		{
			List<XQ.SP.Model.ShopUserSetItem> modelList = new List<XQ.SP.Model.ShopUserSetItem>();
			int rowsCount = dt.Rows.Count;
			if (rowsCount > 0)
			{
				XQ.SP.Model.ShopUserSetItem model;
				for (int n = 0; n < rowsCount; n++)
				{
					model = new XQ.SP.Model.ShopUserSetItem();					
													if(dt.Rows[n]["Id"].ToString()!="")
				{
					model.Id=long.Parse(dt.Rows[n]["Id"].ToString());
				}
																																if(dt.Rows[n]["UserInfoId"].ToString()!="")
				{
					model.UserInfoId=long.Parse(dt.Rows[n]["UserInfoId"].ToString());
				}
																																				model.WebName= dt.Rows[n]["WebName"].ToString();
																																model.Keys= dt.Rows[n]["Keys"].ToString();
																																model.Description= dt.Rows[n]["Description"].ToString();
																																model.Logo= dt.Rows[n]["Logo"].ToString();
																																model.BackColor= dt.Rows[n]["BackColor"].ToString();
																																model.Url= dt.Rows[n]["Url"].ToString();
																																model.RealName= dt.Rows[n]["RealName"].ToString();
																																model.BankName= dt.Rows[n]["BankName"].ToString();
																																model.BankStartPlace= dt.Rows[n]["BankStartPlace"].ToString();
																																model.BankNo= dt.Rows[n]["BankNo"].ToString();
																												if(dt.Rows[n]["Level"].ToString()!="")
				{
					model.Level=int.Parse(dt.Rows[n]["Level"].ToString());
				}
																																if(dt.Rows[n]["Status"].ToString()!="")
				{
					model.Status=int.Parse(dt.Rows[n]["Status"].ToString());
				}
																																if(dt.Rows[n]["Creator"].ToString()!="")
				{
					model.Creator=long.Parse(dt.Rows[n]["Creator"].ToString());
				}
																																if(dt.Rows[n]["Created"].ToString()!="")
				{
					model.Created=DateTime.Parse(dt.Rows[n]["Created"].ToString());
				}
																																if(dt.Rows[n]["Modifier"].ToString()!="")
				{
					model.Modifier=long.Parse(dt.Rows[n]["Modifier"].ToString());
				}
																																if(dt.Rows[n]["Modified"].ToString()!="")
				{
					model.Modified=DateTime.Parse(dt.Rows[n]["Modified"].ToString());
				}
																																				model.OfficePhone= dt.Rows[n]["OfficePhone"].ToString();
																																model.Telephone= dt.Rows[n]["Telephone"].ToString();
																																model.WeChat= dt.Rows[n]["WeChat"].ToString();
																																model.QqGroup= dt.Rows[n]["QqGroup"].ToString();
																																model.QQ= dt.Rows[n]["QQ"].ToString();
																																model.IdImage= dt.Rows[n]["IdImage"].ToString();
																																model.IdCard= dt.Rows[n]["IdCard"].ToString();
																																model.Tele400= dt.Rows[n]["Tele400"].ToString();
																																model.NoPublic= dt.Rows[n]["NoPublic"].ToString();
																																model.QQ1= dt.Rows[n]["QQ1"].ToString();
																																model.QQ2= dt.Rows[n]["QQ2"].ToString();
																																model.QQ3= dt.Rows[n]["QQ3"].ToString();
																																model.T1= dt.Rows[n]["T1"].ToString();
																																model.T2= dt.Rows[n]["T2"].ToString();
																																model.T3= dt.Rows[n]["T3"].ToString();
																																model.T4= dt.Rows[n]["T4"].ToString();
																																model.T5= dt.Rows[n]["T5"].ToString();
																						
				
					modelList.Add(model);
				}
			}
			return modelList;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetAllList()
		{
			return GetList("");
		}
		

   
		/// <summary>
		/// Model的属性对应赋值
		/// </summary>
		public void ModelCopy(XQ.SP.Model.ShopUserSetItem modelOld,XQ.SP.Model.ShopUserSetItem modelNew)
		{
			            
            modelNew.Id = modelOld.Id;
                        
            modelNew.UserInfoId = modelOld.UserInfoId;
                        
            modelNew.WebName = modelOld.WebName;
                        
            modelNew.Keys = modelOld.Keys;
                        
            modelNew.Description = modelOld.Description;
                        
            modelNew.Logo = modelOld.Logo;
                        
            modelNew.BackColor = modelOld.BackColor;
                        
            modelNew.Url = modelOld.Url;
                        
            modelNew.RealName = modelOld.RealName;
                        
            modelNew.BankName = modelOld.BankName;
                        
            modelNew.BankStartPlace = modelOld.BankStartPlace;
                        
            modelNew.BankNo = modelOld.BankNo;
                        
            modelNew.Level = modelOld.Level;
                        
            modelNew.Status = modelOld.Status;
                        
            modelNew.Creator = modelOld.Creator;
                        
            modelNew.Created = modelOld.Created;
                        
            modelNew.Modifier = modelOld.Modifier;
                        
            modelNew.Modified = modelOld.Modified;
                        
            modelNew.OfficePhone = modelOld.OfficePhone;
                        
            modelNew.Telephone = modelOld.Telephone;
                        
            modelNew.WeChat = modelOld.WeChat;
                        
            modelNew.QqGroup = modelOld.QqGroup;
                        
            modelNew.QQ = modelOld.QQ;
                        
            modelNew.IdImage = modelOld.IdImage;
                        
            modelNew.IdCard = modelOld.IdCard;
                        
            modelNew.Tele400 = modelOld.Tele400;
                        
            modelNew.NoPublic = modelOld.NoPublic;
                        
            modelNew.QQ1 = modelOld.QQ1;
                        
            modelNew.QQ2 = modelOld.QQ2;
                        
            modelNew.QQ3 = modelOld.QQ3;
                        
            modelNew.T1 = modelOld.T1;
                        
            modelNew.T2 = modelOld.T2;
                        
            modelNew.T3 = modelOld.T3;
                        
            modelNew.T4 = modelOld.T4;
                        
            modelNew.T5 = modelOld.T5;
            		}
#endregion
   
	}
}